define(['./bslPopPosition'],function(bslPopPosition){
    var option = {

        createOption: function(sourceOption){
            var me = this;

            var formatValue = Camera.EncodingType.JPEG;
            var popoverValue, cameraDirection = Camera.Direction.BACK;
            
            for (var key in sourceOption){

                if (key == "filename") {//拍照或摄像文件保存的路径
//                    me.pathForCopy = sourceOption[key];
                }

                if (key == "format"){//拍照或摄像的文件格式
                    var temp = sourceOption[key];
                    formatValue = (temp == "png") ? Camera.EncodingType.PNG : Camera.EncodingType.JPEG;
                }

                if (key == "index") {//拍照或摄像默认使用的摄像头
                    var indexValue = sourceOption[key];
                    cameraDirection = (indexValue == 2) ? Camera.Direction.FRONT : Camera.Direction.BACK;
                } 

                if (key == "popover"){//拍照或摄像界面弹出指示区域
                    var popover = sourceOption[key];
                    if (popover) {
                        popoverValue = bslPopPosition.createPopPostion(popover);
                    } 
                }
            }

            var op = {
                quality : 50,//文档建议ios下quality < 50
                destinationType : Camera.DestinationType.FILE_URI,
                sourceType : Camera.PictureSourceType.CAMERA,
                // allowEdit : true,
                encodingType: formatValue,
                // targetWidth: 100,
                // targetHeight: 100,
                popoverOptions: popoverValue,
                saveToPhotoAlbum: true,
                cameraDirection: cameraDirection
            };

            return op;
        }
    };

    return option;

});
